<!doctype html>
<html class="no-js">
<head>
  <meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <title>科目二信息</title>
  <meta name="description" content="科目二信息">
  <meta name="keywords" content="index">
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
  <meta name="renderer" content="webkit">
  
  <meta http-equiv="Cache-Control" content="no-siteapp" />
  <link rel="icon" type="image/png" href="assets/i/favicon.png">
  <link rel="apple-touch-icon-precomposed" href="assets/i/app-icon72x72@2x.png">
  <meta name="apple-mobile-web-app-title" content="Amaze UI" />
  <link rel="stylesheet" href="assets/css/amazeui.min.css"/>
  <link rel="stylesheet" href="assets/css/admin.css">
  <script src="assets/js/jquery.min.js"></script> 
  <script src="assets/js/amazeui.min.js"></script>
  <script src="assets/js/app.js"></script>
  
  <style type="text/css">
  	/*注册弹出框样式*/
     .black_overlay { 
            display: none; 
            position: absolute;  
            top: 0%; 
            left: 0%; 
            width: 100%; 
            height: 100%; 
            background-color: Black; 
            z-index:1001;             
            opacity:.80;         
      } 
     .white_content { 
            display: none; 
            position: absolute; 
            top: 5%; 
            left: 5%; 
            width: 90%; 
            height: 90%;
            z-index:1002; 
            overflow: auto; 
      } 
 </style>
  
<script type="text/javascript">
    $(function(){
        /*公共部分
         */
        $(".headerpage").load("Head.html"); 
        $(".navigation").load("Navigation.html");
        if(sessionStorage.getItem('user_token')==null){
     	window.location.href="index.html";
     }
    });
</script>

<script type="text/javascript">
	 $(function(){  
		 $.ajax({
		  	type:"post",
		  	url:"http://121.5.208.41:8085/subtow/selectall",
		  	beforeSend: function (XMLHttpRequest) {
                    XMLHttpRequest.setRequestHeader("token", sessionStorage.getItem('user_token'));
                },
		  	data:{},
		  	success: function(data){
		        //方法中传入的参数data为后台获取的数据
		        for(i in data.data) //data.data指的是数组，数组里是8个对象，i为数组的索引
		        {
		            var tr;
		            tr='<td>'+data.data[i].name+'</td>'+'<td>'+data.data[i].identity+'</td>'+
	                '<td>'+data.data[i].examTime+'</td>'+'<td>'+data.data[i].examPlace+'</td>'+
	                '<td>'+data.data[i].score+'</td>'+'<td>'+data.data[i].isrepeat+'</td>'+
	                '<td>'+data.data[i].repeatNum+'</td>'+
	                '<td>'+'<button class="am-btn am-btn-default am-btn-xs am-text-secondary" onclick="UpdateById('+data.data[i].id+')"><span class="am-icon-pencil-square-o"></span>修改</button>' +
	                '<button class="am-btn am-btn-default am-btn-xs am-text-danger" onclick="DeleteById('+data.data[i].id+')"><span class="am-icon-trash-o"></span>删除</button>'+'</td>';
	                tr=tr.replace(/null/g,""); 
		            $("#tablejd").append('<tr>'+tr+'</tr>')
		        }
		     }		  	
		 });

   });
</script>


<script type="text/javascript">
	/**
   * 搜索框查询
   */
	$(function(){
		$("#chazhao").click(function(){
			
		    
			var tdata={ 
				"name":$("#xingming").val(),
				"identity":$("#shenfen").val()
			}
			$.ajax({
				type:"post",
				url:"http://121.5.208.41:8085/subtow/selectInput",
				beforeSend: function (XMLHttpRequest) {
                    XMLHttpRequest.setRequestHeader("token", sessionStorage.getItem('user_token'));
                },
				data:JSON.stringify(tdata),
				contentType:"application/json;charset=utf-8",
				success: function(data){
					   if(data.code == "MYSXTJ"){
					   	alert(data.msg);
					   }else{
					   	 document.getElementById('black').style.display='block';
			         document.getElementById('light').style.display='block';
					   	 //方法中传入的参数data为后台获取的数据
			         for(i in data.data) //data.data指的是数组，数组里是8个对象，i为数组的索引
			          {
			             var tr;
			            tr='<td>'+data.data[i].name+'</td>'+'<td>'+data.data[i].identity+'</td>'+'<td>'+data.data[i].examTime+'</td>'+
		                '<td>'+data.data[i].examPlace+'</td>'+'<td>'+data.data[i].score+'</td>'+'<td>'+data.data[i].isrepeat+'</td>'+'<td>'+data.data[i].repeatNum+'</td>'+
		                '<td>'+'<button class="am-btn am-btn-default am-btn-xs am-text-secondary" onclick="UpdateById('+data.data[i].id+')"><span class="am-icon-pencil-square-o"></span>修改</button>' +
	                '<button class="am-btn am-btn-default am-btn-xs am-text-danger" onclick="DeleteById('+data.data[i].id+')"><span class="am-icon-trash-o"></span>删除</button>'+'</td>';
	                tr=tr.replace(/null/g,""); 
			            $("#tabletest").append('<tr>'+tr+'</tr>')
			          }
					   }
			       
			                      
			   }	
			})	
			
			$("#fanhui").click(function(){
			 document.getElementById('black').style.display='none';
			 document.getElementById('light').style.display='none';
       window.location.href="subTow.html";  	
		})
			
		})
	})
	
</script>


<script>
	/**
	 * 
	 * @param {删除} id
	 */
	function DeleteById(id){
		if(window.confirm("确定要删除吗？"))
    {
    	 var tdata = {
    	 	  "id" : id 
    	 }
       $.ajax({
				type:"post",
				url:"http://121.5.208.41:8085/subtow/deleteById",
				beforeSend: function (XMLHttpRequest) {
                    XMLHttpRequest.setRequestHeader("token", sessionStorage.getItem('user_token'));
                },
				data: JSON.stringify(tdata),
				contentType:"application/json;charset=utf-8",
				success: function(data){
			        //方法中传入的参数data为后台获取的数据
			      if(data.code == "SQCG"){
			      	alert("删除成功！");
			      	window.location.href="subTow.html";
			      }else{
			      	alert("删除失败！")
			      }
			                      
			   }	
			})
    }   
    else
    {
       
    }
	}
	
	/**
	 * 
	 * @param {更新 （先查询数据显示 ，后更改提交）} id
	 */
	function UpdateById(id){
		   var tdata = {
    	 	  "id" : id 
    	 }
		   document.getElementById('light').style.display='none';
		   document.getElementById('black').style.display='block';
	   	 document.getElementById('updateYemian').style.display='block';
       $.ajax({
				type:"post",
				url:"http://121.5.208.41:8085/subtow/selectById",
				beforeSend: function (XMLHttpRequest) {
                    XMLHttpRequest.setRequestHeader("token", sessionStorage.getItem('user_token'));
                },
				data: JSON.stringify(tdata),
				contentType:"application/json;charset=utf-8",
				success: function(data){
			        var tr;
			         tr= '<li>'+'&nbsp;&nbsp;&nbsp;id&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;：<input type="text" id="qrid" readonly="readonly" value="'+data.data.id+'"/>'+'</li>'+
			         '<li>'+'&nbsp;&nbsp;姓名：<input type="text" id="qrname"  value="'+data.data.name+'"/>'+'</li>'+
			         '<li>'+'&nbsp;&nbsp;&nbsp;身份证号：<input type="text" id="qrsex" readonly="readonly"  value="'+data.data.identity+'" />'+'</li>'+
			         '<li>'+'&nbsp;考试时间&nbsp;：<input type="text" id="qridentity"  value="'+data.data.examTime+'" />'+'</li>'+
			         '<li>'+'&nbsp;&nbsp;&nbsp;考试地点&nbsp;：<input type="text" id="qrphone" value="'+data.data.examPlace+'" />'+'</li>'+
			         '<li>'+'成绩：<input type="text" id="qrbirthDate"  value="'+data.data.score+'" />'+'</li>'+
			         '<li>'+'&nbsp;&nbsp;&nbsp;成绩评定：<input type="text" id="qrnationality" value="'+data.data.isrepeat+'"/>'+'</li>'+
			         '<li>'+'补考次数：<input type="text" id="qrlicense" value="'+data.data.repeatNum+'"/>'+'</li>'+
			         '<li>'+'<button onclick="queren()" class="am-btn am-btn-default am-btn-xs am-text-secondary">确认</button><button onclick="quxiao()" class="am-btn am-btn-default am-btn-xs am-text-secondary">取消</button>'+'</li>';
			         tr=tr.replace(/null/g,""); 
			            $("#ulUpdeat").append(tr)
			                      
			   }	
			})
	}
	
</script>

<script>
	/**
	 * 取消修改
	 */
	function quxiao(){
		window.location.href="subTow.html";
	}
	/**
	 * 确认修改
	 */
	function queren(){
		var gdata ={
			    "id" : $("#qrid").val(),
    	  	"name": $("#qrname").val(),
    	  	"identity": $("#qrsex").val(),   	 	
    	  	"examTime": $("#qridentity").val(),
    	  	"examPlace": $("#qrphone").val(),
    	  	"score": $("#qrbirthDate").val(),
    	  	"isrepeat": $("#qrnationality").val(),
    	  	"repeatNum": $("#qrlicense").val()
      	}
		$.ajax({
          		url : "http://121.5.208.41:8085/subtow/updateById",
          		beforeSend: function (XMLHttpRequest) {
                    XMLHttpRequest.setRequestHeader("token", sessionStorage.getItem('user_token'));
                },
			      	type : "post",
		          contentType : "application/json;charset=utf-8",
		          data : JSON.stringify(gdata),
		          dataType :"json",
		          success : function(data){
		          	if (data.code == "GXCG") {
		          		alert(data.msg)
		          		window.location.href="subTow.html";
		          	}else{
		          		alert(data.msg)
		          	}
		          }
    	  })
	}
	
</script>


 
</head>


<body>
<header class="headerpage"></header>

<div class="am-cf admin-main"> 
  <!--菜单栏-->
  <div class="navigation"></div>




  <div class="admin-content">

    <div class="am-cf am-padding">
      <div class="am-fl am-cf"><!--<strong class="am-text-primary am-text-lg">首页</strong>-->
      	<strong class="am-text-primary am-text-lg">科目二</strong> / <small>信息</small>
   &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;
  &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;
      </div> 
      
      
      <div class="am-u-md-3 am-cf">
        <div class="am-fr">
          <div class="am-input-group am-input-group-sm">
            <input  type="text" class="am-form-field" id="xingming" placeholder="请输入姓名"/>
          </div>
        </div>
      </div>
      <div class="am-u-md-3 am-cf">
        <div class="am-fr">
          <div class="am-input-group am-input-group-sm">
      	    <input  type="text" class="am-form-field" id="shenfen" placeholder="请输入身份证号"/>
                <span class="am-input-group-btn">
                  <button class="am-btn am-btn-default" id="chazhao" type="button">搜索</button>
                </span>
          </div>
        </div>
      </div>
      
      
    </div> 
   
   
   
   
    <div id="fade" class="am-g">
      <div class="am-u-sm-12">
      
        <table id="tablejd" class="am-table am-table-bd am-table-striped admin-content-table">
          <thead>
          <tr>
            <th>姓名</th><th>身份证号</th><th>考试时间</th><th>考试地点</th>
            <th>考试成绩</th><th>是否及格</th><th>补考次数</th>
            
          </tr>
          </thead>
         
        </table>
      
      </div>
    </div>
    
</div>
</div>

<div id="black" class="black_overlay"></div>

<div id="updateYemian" class="white_content">	
	 <div class="admin-content">
	  <div class="am-cf am-padding">
      <div class="am-fl am-cf"><strong class="am-text-primary am-text-lg">修改</strong> / <small>信息</small></div>
    </div>
    <ul id="ulUpdeat" class="am-avg-sm-3 am-avg-md-3 am-avg-lg-4 am-margin gallery-list"> </ul>
   </div>
</div>

<!--注册弹出框-->
<div id="light" class="white_content">
		
  <!-- content start -->
  <div class="admin-content">

    <div class="am-cf am-padding">
      <div class="am-fl am-cf"><strong class="am-text-primary am-text-lg">科二</strong> / <small>信息</small></div>
    </div>

    <div class="am-g">
      <div class="am-u-sm-12">
        
          <table id="tabletest"  class="am-table am-table-striped am-table-hover table-main">
            <thead>
              <tr>
            <th>姓名</th><th>身份证</th><th>考试时间</th>
            <th>考试地点</th><th>考试成绩</th><th>评定</th><th>补考次数</th>
           <th>操作</th>
          </tr>
          </thead>
        </table>
        <button id="fanhui" class="am-btn am-btn-default am-btn-xs am-text-secondary">返回</button>
       
      </div>
    </div>
    
  </div>
  <!-- content end -->
     
</div>

</body>
</html>
